/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace DaveSexton.DocProject
{
	public sealed class DataGridViewFileCell : DataGridViewTextBoxCell
	{
		#region Public Properties
		public override Type EditType
		{
			get
			{
				return typeof(DataGridViewFileCellControl);
			}
		}
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="DataGridViewFileCell" /> class.
		/// </summary>
		public DataGridViewFileCell()
		{
		}
		#endregion

		#region Methods
		public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
		{
			base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);

			DataGridViewFileCellControl control = DataGridView.EditingControl as DataGridViewFileCellControl;
			control.Value = (string) initialFormattedValue;
			control.Column = DataGridView.Columns[this.ColumnIndex] as DataGridViewFileColumn;
		}
		#endregion
	}
}
